<template>
	<view class="personaldetails">
		<view class="personaldetails_top">
			<view class="personaldetails_top_a">
				<text class="text1">{{information.realName}}</text>
				<text class="text2">在线时间：{{information.serviceStartTime}}-{{information.serviceEndTime}}</text>
				<text class="text3">本月累计在线：{{monthOnlineTime}}h</text>
				<view class="text4">
					<view class="text5">
						<image class="img" :src="information.avatar"></image>
					</view>
					<view class="text6"> 在线</view>
				</view>
			</view>
			<view class="personaldetails_bottom">
				<view class="personaldetails_bottom_a">
					<view class="getinstall_top_bottom_c">
						<view class="getinstall_top_bottom_left">
							<text class="text1">性别</text>
							<view class="text" v-html="information.gender==0? '男':''">{{information.gender}}</view>
							<view class="text2" v-html="information.gender==1? '女':''">{{information.gender}}</view>
							<view class="text" v-html="information.gender==2? '未知':''">{{information.gender}}</view>
						</view>
						
					</view>
					<view class="getinstall_top_bottom_c">
						<view class="getinstall_top_bottom_left">
							<text class="text1">技师类型</text>
							<text class="text">{{information.masseuseTypeName}}</text>
						</view>
						
					</view>
					<view class="getinstall_top_bottom_c_a">
						<view class="getinstall_top_bottom_left">
							<view class="text1">服务项目</view>
							<view class="boox">
								<view class="text" v-for="item in detailslist" :key="item.id">
									<text>{{item.serviceName}}</text>
									
								</view>
							</view>
							
						</view>
						
					</view>
					<view class="getinstall_top_bottom_c">
						<view class="getinstall_top_bottom_left">
							<text class="text1">工龄</text>
							<text class="text">{{information.workingYears}}年</text>
						</view>
						
					</view>
					<view class="getinstall_top_bottom_c">
						<view class="getinstall_top_bottom_left">
							<text class="text1">手机号</text>
							<text class="text">{{information.phone}}</text>
						</view>
						
					</view>
					<!-- <view class="getinstall_top_bottom_c">
						<view class="getinstall_top_bottom_left">
							<text class="text1">意向城市</text>
							<text class="text">{{information.cityName}}</text>
						</view>
						
					</view> -->
					<view class="getinstall_top_bottom_c_x">
						<view class="getinstall_top_bottom_left">
							<view class="text1">详细地址</view>
							<text class="text">{{information.address}}</text>
						</view>
						
					</view>
					<view class="getinstall_top_bottom_c_b">
						<view class="getinstall_top_bottom_left">
							<text class="text1">承诺书</text>
							<view class="box">
								<image class="img" src="../../static/imgs/word.png"></image>
								<text class="text">承诺书.word</text>
							</view>
							
							
						</view>
						<text class="text2" @click="download">下载</text>
					</view>
					<view class="getinstall_top_bottom_zhaopian">
						<view class="getinstall_top_bottom_left">
							<text class="text1">技师风采</text>
							<view class="text" v-for="it in styleUrllist" :key='it.id'>
								<image class="img"  :src="it"></image>
								
							</view>
						</view>
						
					</view>
					<view class="getinstall_top_bottom_zhaopian">
						<view class="getinstall_top_bottom_left">
							<text class="text1">技师资质</text>
							<view class="texts" style="width: 80%;">
								<image class="imgs"  :src="information.certificateUrl"></image>
								
							</view>
						</view>
						
					</view>
					<view class="getinstall_top_bottom_zhaopian">
						<view class="getinstall_top_bottom_left">
							<text class="text1">商家信息</text>
							<view class="texts">
								<image style="width: 98rpx;
								height: 148rpx;margin-left: 20rpx;" :src="information.licenseUrl"></image>
								
							</view>
						</view>
						
					</view>
					<view class="getinstall_top_bottom_c">
						<view class="getinstall_top_bottom_left">
							<text class="text1">实名认证</text>
							<view class="text" v-html="information.applymentStatus==1? '已认证':''" :style="information.applymentStatus==1? 'color: #00DF25;':''"></view>
							<view class="text" v-html="information.applymentStatus==0? '未认证':''" :style="information.applymentStatus==0? 'color: #cccccc;':''"></view>
							<view class="text" v-html="information.applymentStatus==2? '已驳回':''" :style="information.applymentStatus==2? 'color: #FF8F1F;':''"></view>
						</view>
						
					</view>
					<view class="getinstall_top_bottom_d">
						<view class="getinstall_top_bottom_left">
							<view class="text1">个人介绍</view>
							<view class="text">{{information.introduction}}</view>
						</view>
						
					</view>
				</view>
			</view>
			<view class="xiugai" @click="modifieddata">
				点击修改资料
			</view>
			<view class="bottom">
				 
			</view>
		</view>
	</view>
</template>

<script>
	import homeServices from '../../service/homeService'
	export default{
		data(){
			return{
				information:{},
				list:[],
				obj:'',
				obj1:'',
				obj2:'',
				obj3:'',
				lists:[],
				lists1:[],
				lists2:[],
				detailslist:[],
				id:'',
				styleUrllist:[],
				monthOnlineTime:'',
				URL:''
				
			}
		},
		methods:{
			download(){
					uni.downloadFile({
							url: this.URL,//下载地址接口返回
							success: (data) => {
								console.log(data)
								console.log(JSON.stringify(data))
								if (data.statusCode == 200) {
									//文件保存到本地
									uni.saveFile({
										tempFilePath: data.tempFilePath, //临时路径 
										success: function(res) {
											console.log(res)
											uni.showToast({
												icon: 'none',
												mask: true,
												title: '文件已保存：' + res.savedFilePath, //保存路径 
												duration: 3000,
											});
											setTimeout(() => {
												//打开文档查看
												uni.openDocument({
													filePath: res.savedFilePath,
													success: function(res) {
														// console.log('打开文档成功');
													}
												});
											}, 3000)
										}
									});
								}
							},
							fail: (err) => {
								console.log(err);
								uni.showToast({
									icon: 'none',
									mask: true,
									title: '失败请重新下载',
								});
							},
						});
				
			},
			modifieddata(){
				uni.navigateTo({
					url:`../../pagesA/modifieddata/modifieddata?id=${this.id}`
				})
			},
		 async	getlist(){
				
			
				let params={}
				let res= await homeServices.getlist()
				
				this.id=res.data.id
				console.log(this.id)
				this.information=res.data
				this.URL=res.data.agreementUrl
				console.log(this.information,'jjjjjjjjjjjjjj')
				this.detailslist=res.data.serviceItems
				this.styleUrllist=res.data.styleUrl.split(',')
				
				// this.lists.forEach(item=>{
				// if(item.imgType==1){
				// 	this.lists1.push(item)
					
				// }
				// if(item.imgType==2){
				// 	this.lists2.push(item)
				// 	console.log(this.lists2)
				// }
				// })
				
			}
		},
		onLoad(id) {
			this.monthOnlineTime=id.monthOnlineTime
			this.getlist()
		}
	}
</script>

<style lang="scss" scoped>
	@import '@/static/sass/personaldetails.scss'
</style>